/*
 * @Author: qianmingtian
 * @Date: 2020-07-03 11:16:51
 * @LastEditors: qianmingtian
 * @LastEditTime: 2020-07-03 11:56:11
 * @FilePath: \qianmingtian.github.io\code\java\com\zhuandshao\ExtendTest.java
 */
package com.zhuandshao;

class A {
    private int num;
    int age;

    public A() {
        System.out.println(" a gouzao ");
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    private void p(String string) {
        System.out.println(string + " A class");
    }
    public void pp(){
        p("a ");
    }
}

class B extends A {
    private int b_num;

    public B() {
        super();
    }

    public int getB_num() {
        return b_num;
    }

    public void setB_num(int b_num) {
        this.b_num = b_num;
    }

    private void p(String string) {
        System.out.println(string + " B class");
    }

}

public class ExtendTest {
    public static void main(String[] args) {
        A a = new A();
        B b = new B();
        b.setAge(2);
        b.setNum(3);
        System.out.println(a.getNum());;
        System.out.println(b.getNum());;

        b.pp();
        b.toString();
        // b.num; //会报错 ，
    }
}/*
  * @Author: qianmingtian
  * 
  * @Date: 2020-07-03 11:16:51
  * 
  * @LastEditors: qianmingtian
  * 
  * @LastEditTime: 2020-07-03 11:16:51
  * 
  * @FilePath: \qianmingtian.github.io\code\java\com\zhuandshao\ExtendTest.java
  */
